{include file="common/head"/}
<div class="admin-main layui-anim layui-anim-upbit">
    
    <form class="layui-form layui-form-pane">
        <input type="hidden" name="order_id" id="" value="{$list.order_id}">
        <fieldset class="layui-elem-field layui-field-title">
            <legend>订单信息</legend>
        </fieldset>
        <div class="layui-form-item">
            <label class="layui-form-label">订单编号</label>
            <div class="layui-input-4">
                <input type="text" maxlength="200" disabled value="{$list.order_number}"
                    lay-verify="order_number" placeholder="请输入订单编号" class="layui-input">
            </div>
        </div>
       
        <div class="layui-form-item">
            <label class="layui-form-label">房间分类</label>
            <div class="layui-input-4">
                <input type="text" maxlength="200" disabled value="{$list.one_cate==0?'过夜房':'钟点房'}-{$list.two_cate}"
                    class="layui-input">
            </div>
        </div>
        <div class="layui-form-item">
            <label class="layui-form-label">房间类型</label>
            <div class="layui-input-4">
                <input type="text" maxlength="200" disabled value="{$list.is_activity==0?'普通房':'活动房'}"
                    class="layui-input">
            </div>
        </div>

        <div class="layui-form-item">
            <label class="layui-form-label">入住天数</label>
            <div class="layui-input-4">
                <input type="text" maxlength="200" disabled value="{$list.days}" lay-verify="days"
                    placeholder="请输入入住天数" class="layui-input">
            </div>
        </div>
        <div class="layui-form-item">
            <label class="layui-form-label">下单时间</label>
            <div class="layui-input-4">
                <input type="text" maxlength="200" value="{:date('Y-m-d',$list.addtime)}" disabled lay-verify="addtime" class="layui-input">
            </div>
        </div>
        <div class="layui-form-item">
            <label class="layui-form-label">支付时间</label>
            <div class="layui-input-4">
                <input type="text" maxlength="200" disabled value="{:date('Y-m-d',$list.paytime)}" lay-verify="days" placeholder="请输入入住天数"
                    class="layui-input">
            </div>
        </div>

        
        <div class="layui-form-item">
            <label class="layui-form-label">支付方式</label>
            <div class="layui-input-4">
                <input type="text" maxlength="200" disabled
                    value="{$list.type==0?'微信支付':''}{$list.type==1?'次卡支付':''}{$list.type==2?'余额支付':''}" lay-verify="realname"
                    class="layui-input">
            </div>
        </div>
        <div class="layui-form-item">
            <label class="layui-form-label">下单金额</label>
            <div class="layui-input-4">
                <input type="text" maxlength="200" disabled value="{$list.money}" lay-verify="money"
                    class="layui-input">
            </div>
        </div>

        <div class="layui-form-item">
            <label class="layui-form-label">入住时间</label>
            <div class="layui-input-4">
                <input type="text" maxlength="200" disabled value="{:date('Y-m-d',$list.in_time)}" class="layui-input">
            </div>
        </div>

        <div class="layui-form-item">
            <label class="layui-form-label">离店时间</label>
            <div class="layui-input-4">
                <input type="text" maxlength="200" disabled value="{:date('Y-m-d',$list.out_time)}" class="layui-input">
            </div>
        </div>
        {if $list.invoice_id!=0}
        <fieldset class="layui-elem-field layui-field-title">
            <legend>发票信息</legend>
        </fieldset>
        <div class="layui-form-item">
            <label class="layui-form-label">发票类型</label>
            <div class="layui-input-4">
                <input type="text" maxlength="200" value="{$list.invoice_cateid==0?'企业':'个人'}" disabled class="layui-input">
            </div>
        </div>
        {if $list.invoice_cateid==1}
        <div class="layui-form-item">
            <label class="layui-form-label">姓名</label>
            <div class="layui-input-4">
                <input type="text" maxlength="200" value="{$list.name}" disabled class="layui-input">
            </div>
        </div>
        {else \}
        <div class="layui-form-item">
            <label class="layui-form-label">企业名称</label>
            <div class="layui-input-4">
                <input type="text" maxlength="200" value="{$list.company}" disabled class="layui-input">
            </div>
        </div>
        <div class="layui-form-item">
            <label class="layui-form-label">识别号</label>
            <div class="layui-input-4">
                <input type="text" maxlength="200" value="{$list.indentify_num}" disabled class="layui-input">
            </div>
        </div>
        <div class="layui-form-item">
            <label class="layui-form-label">注册地址</label>
            <div class="layui-input-4">
                <input type="text" maxlength="200" value="{$list.address}" disabled class="layui-input">
            </div>
        </div>
        <div class="layui-form-item">
            <label class="layui-form-label">企业电话</label>
            <div class="layui-input-4">
                <input type="text" maxlength="200" value="{$list.phone}" disabled class="layui-input">
            </div>
        </div>
        <div class="layui-form-item">
            <label class="layui-form-label">开户行</label>
            <div class="layui-input-4">
                <input type="text" maxlength="200" value="{$list.bank}" disabled class="layui-input">
            </div>
        </div>
        <div class="layui-form-item">
            <label class="layui-form-label">企业账号</label>
            <div class="layui-input-4">
                <input type="text" maxlength="200" value="{$list.number}" disabled  class="layui-input">
            </div>
        </div>


        <div class="layui-form-item">
            <label class="layui-form-label">是否已开发票{$list.status}</label>
            <div class="layui-input-inline">
                <select name="invoice_status" lay-filter="status" lay-search id="category">
                    <option value="0" {if $list.invoice_status==0}selected{/if}>未开发票</option>
                    <option value="1" {if $list.invoice_status==1}selected{/if}>已开发票</option>
                </select>
            </div>
            <div class="layui-form-mid layui-word-aux">开发票之后改变发票状态</div>
        </div>
        {/if}


        {/if}


        
        {volist name="list['userlist']" id='vo' key="key"}
            
        <fieldset class="layui-elem-field layui-field-title">
            <legend>用户信息登记{$key}</legend>
        </fieldset>
        <div class="layui-form-item">
            <label class="layui-form-label">姓名</label>
            <div class="layui-input-4">
                <input type="text" maxlength="200" name="name" value="{$vo.name}" lay-verify="required"
                    placeholder="请输入姓名" class="classname layui-input">
            </div>
            <div class="layui-form-mid layui-word-aux">住户真实姓名</div>
        </div>
        <div class="layui-form-item">
            <label class="layui-form-label">手机号</label>
            <div class="layui-input-4">
                <input type="text" maxlength="200" name="phone" value="{$vo.phone}" lay-verify="required|phone"
                    placeholder="请输入手机号" class="layui-input">
            </div>
            <div class="layui-form-mid layui-word-aux">住户真实手机号</div>
        </div>
        <div class="layui-form-item">
            <label class="layui-form-label">性别</label>
            <div class="layui-input-4">
                <input type="radio" class="radeo" name="sex{$key}" value="1" lay-verify="required" title="男" {if $vo.sex==1 }checked{/if}>
                <input type="radio" class="radeo" name="sex{$key}" value="2" lay-verify="required" title="女" {if $vo.sex==2 }checked{/if}>
                <input type="radio" class="radeo" name="sex{$key}" value="3" lay-verify="required" title="未知" {if $vo.sex==3 }checked{/if} disabled >
            </div>
        </div>
        <div class="layui-form-item">
            <label class="layui-form-label">身份证号</label>
            <div class="layui-input-4">
                <input type="text" maxlength="200" name="idcard" value="{$vo.idcard}" lay-verify="idcard"
                    placeholder="请输入身份证号" class="layui-input"  lay-verify="required">
            </div>
        </div>
        <div class="layui-form-item">
            <label class="layui-form-label">联系地址</label>
            <div class="layui-input-4">
                <input type="text" maxlength="200" name="address" value="{$vo.address}" lay-verify="address"
                    placeholder="请填写联系地址" class="layui-input"  lay-verify="required">
            </div>
        </div>

        {/volist}
        {if $list.status >=1 && $list.status != 2 && $list.status != 3 && $list.status != 4 }
        <div class="layui-form-item">
            <label class="layui-form-label">住房押金</label>
            <div class="layui-input-4">
                <input type="text" maxlength="200" name="address" value="{$list.deposit}" lay-verify="address"
                    placeholder="住房押金" class="layui-input"  lay-verify="required">
            </div>
            <div class="layui-form-mid layui-word-aux">客户住房缴纳的押金</div>
        </div>
        {/if}

        <div class="layui-form-item">
            <label class="layui-form-label">订单状态</label>
            <div class="layui-input-inline">
                <select name="status" lay-filter="status" lay-search id="category">
                    {if $list.status==0}
                    <option value="0" {if $list.status==0}selected{/if}>待支付</option>
                    {/if}
                    {if $list.status==1}
                    <option value="1" {if $list.status==1}selected{/if}>已支付</option>
                    {/if}
                    {if $list.status==1||$list.status==5 || $list.status==4}
                    <option value="5" {if $list.status==3}selected{/if}>已入住</option>
                    {/if}
                    {if $list.status==5 || $list.status==6}
                    <option value="6" {if $list.status==3}selected{/if}>已完成</option>
                    {/if}
                </select>
            </div>
            <div class="layui-form-mid layui-word-aux">订单状态一经改变无法变回</div>
        </div>

        <div class="layui-form-item">
            <div class="layui-input-block">
                <button type="button" class="layui-btn" id="submit" lay-submit=""
                    lay-filter="sys">{:lang('submit')}</button>
            </div>
        </div>




    </form>
</div>
{include file="common/foot"/}
<script>
   

    layui.use(['form', 'layer', 'upload'], function () {
        var form = layui.form, layer = layui.layer, upload = layui.upload, $ = layui.jquery;
        form.verify({
            title: function (value) {
                if (value == '') {
                    return '请输入优惠券分类名称!';
                }
            },

        });
        form.render()
        form.on('submit(sys)', function (data) {
            $("#submit").attr({ disabled: "disabled" });
            loading = layer.load(1, { shade: [0.1, '#fff'] });
            let arr = $('.classname')
            let leng = arr.length 
            let datas = []
            for(let i=0;i<leng;i++){
                let obg = {}
                obg.name = $('input[name="name"]').eq(i).val()
                obg.phone = $('input[name="phone"]').eq(i).val()
                obg.sex = $('input[class="radeo"]:checked').eq(i).val()
                obg.idcard = $('input[name="idcard"]').eq(i).val()
                obg.address = $('input[name="address"]').eq(i).val()
                datas.push(obg)
            }

            let mydata = {
                order_id:data.field.order_id,
                userlist:JSON.stringify(datas),
                invoice_status:data.field.invoice_status||0,
                status:data.field.status
            }

            $.post("{:url('orderEdit')}", mydata, function (res) {
                layer.close(loading);
                if (res.errorCode == 8888) {
                    layer.msg(res.msg, { icon: 1, time: 1000 }, function () {
                        location.href = '{:url("order")}';
                    });
                } else {
                    $("#submit").removeAttr("disabled");
                    layer.msg(res.msg, { icon: 2, time: 1000 });
                }
            });
        })
    })


</script>


</body>

</html>